package com.xmg.model;

/**
 * @author xmg
 * @Description AccessToken
 * @email 463364973@qq.com
 * <p>
 * Date:2019/4/5 19:51
 */
public class AccessToken {

    /** accessToken */
    private String accessToken;
    /** 过期时间 */
    private long expiresTime;

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public long getExpiresTime() {
        return expiresTime;
    }

    public void setExpiresTime(long expiresTime) {
        this.expiresTime = expiresTime;
    }

    public AccessToken(String accessToken, String expiresIn) {
        super();
        this.accessToken = accessToken;
        this.expiresTime = System.currentTimeMillis() + Integer.parseInt(expiresIn)*1000;
    }

    /**
     * 判断token是否过期
     * @return
     */
    public boolean isExpired(){
        return System.currentTimeMillis() > this.expiresTime;
    }
}
